package org.rugby.online.impl;

import static org.junit.Assert.*;

import org.junit.Before;
import org.junit.Test;
import org.rugby.online.core.base.RboPoint;
import org.rugby.online.core.places.RboPlace;
import org.rugby.online.impl.DefaultPlace;
import org.rugby.online.impl.DefaultPoint;

public class DefaultPlaceTest {

	private static final String PLACE_NAME = "TESTPLACE";
	private RboPlace place;
	
	@Before
	public void setUp() throws Exception {
		RboPoint point = new DefaultPoint(5, 25);
		place = new DefaultPlace(point);
		place.getShape().add(new DefaultPoint(0, 0));
		place.getShape().add(new DefaultPoint(0, 50));
		place.getShape().add(new DefaultPoint(50, 50));
		place.getShape().add(new DefaultPoint(50, 0));
		((DefaultPlace) place).setName(PLACE_NAME);
	}

	@Test
	public void testGetCenter() {
		int centerX = place.getCenter().getX();
		int centerY = place.getCenter().getY();
		System.out.println("[TEST CENTER] > " + String.valueOf(centerX));
		System.out.println("[TEST CENTER] > " + String.valueOf(centerY));
		assertTrue(centerX == 5);
		assertTrue(centerY == 25);
	}

	@Test
	public void testGetShape() {
		int npoints = place.getShape().size();
		System.out.println("[TEST NPOINTS] > " + String.valueOf(npoints));
		assertTrue(npoints == 4);
	}

	@Test
	public void testGetName() {
		String name = place.getName();
		System.out.println("[TEST NAME] > " + String.valueOf(name));
		assertTrue(place.getName().equals(PLACE_NAME));
	}

	@Test
	public void testGetId() {
		long id = place.getId();
		System.out.println("[TEST ID] > " + String.valueOf(id));
		assertNotNull(id);
	}

}
